package cn.gson.school.controller.zhaosheng;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.gson.school.entity.zhaosheng.FollowupEntity;
import cn.gson.school.mappers.zhaosheng.FollowupMapper;

/**
 * 签约信息Controller
 */
@Controller
@RequestMapping("/followlistall")
public class FollowupAllController {
	@Autowired
	private FollowupMapper followupMapper;

	@RequestMapping("listall")
	@ResponseBody
	public Map<String, Object> indexall(FollowupEntity followEntity, HttpServletRequest request,
			@RequestParam(name = "page", defaultValue = "1") int pageNum,
			@RequestParam(name = "rows", defaultValue = "20") int pageSize) {
		System.out.println("所有跟进记录：" + followEntity);
		PageHelper.startPage(pageNum, pageSize);
		List<FollowupEntity> pageData = (Page<FollowupEntity>) followupMapper.listall(followEntity);
		PageInfo<FollowupEntity> info = new PageInfo<>(pageData);
		Map<String, Object> obj = new HashMap<String, Object>();
		obj.put("total", info.getTotal());
		obj.put("rows", info.getList());
		return obj;
	}

}
